Skip to content

Fail closed when whisper prompt caps coerce bools to 1 - #144

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/whisper-prompt-caps-2ccd
Sep 8, 2026
Merged

Fail closed when whisper prompt caps coerce bools to 1#144
cursor[bot] merged 2 commits into
mainfrom
cursor/whisper-prompt-caps-2ccd

Conversation

@jmjava

@jmjava jmjava commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Problem

Config.from_yaml already requires YAML numbers for whisper prompt caps (#117). Timing enrichment type-checks max_whisper_segment_text_chars (#122). The two count caps still did:

max_seg = int(root.get("max_whisper_segments_in_prompt", 0) or 0)
max_words = int(root.get("max_whisper_words_in_prompt", 0) or 0)

bool is a subclass of int: max_whisper_words_in_prompt: true became 1 and truncated the word stream the scene-spec LLM uses for wait_word. Quoted "12" became 12 instead of raising.

Called out as out of scope of #142.

Change

  • Shared _nonneg_yaml_int for segments / words / chars caps
  • Present bool or non-number raises SceneGenerationError
  • Missing/null still defaults (0 = full stream; chars 200)
  • Explicit 0 still lists every word

Gate

  • ruff check src/ tests/ green
  • pytest tests/ — 804 passed, 1 skipped
  • docgen benchmark meets src/docgen/benchmark_data/baseline.json (no clock change; no --update-baseline)

Out of scope

  • Config.from_yaml already gates these keys for CLI load
  • Validate _check_streams / _check_drift ffprobe returncode
  • Whisper API start/end float(... or 0.0) in ai_client

Milestone: milestones/whisper-prompt-caps.md

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 8, 2026 00:49
Timing enrichment already type-checks max_whisper_segment_text_chars.
The count caps still used int(... or 0), so true became 1 and truncated
the word stream the scene-spec LLM uses for wait_word.

Co-authored-by: jmjava <jmjava@gmail.com>
ruff green; pytest 804 passed, 1 skipped; docgen benchmark meets baseline.

Co-authored-by: jmjava <jmjava@gmail.com>
@jmjava
jmjava marked this pull request as ready for review September 8, 2026 00:50
@cursor
cursor Bot merged commit 23c6a75 into main Sep 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants